package com.example.ObserverPattern_EventBus.observer;

import com.example.ObserverPattern_EventBus.service.PromotionService;
import com.google.common.eventbus.Subscribe;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * <pre>
 * 功能描述：
 * </pre>
 *
 * @author: 李明杰
 * @date: 2022/12/12 21:05
 */
@Component
public class RegPromotionObserver {
    @Resource
    private PromotionService promotionService; // 依赖注入

    @Subscribe//如果有匹配的通知类型会自动执行
    public void handleRegSuccess(Long userId) {
        promotionService.issueNewUserExperienceCash(userId);
    }
}
